﻿using System;
using Core.Combat.FlyerObj;
using UnityEngine;

namespace Core.Combat.CoreModule
{
    /// <summary>
    /// 子弹核心模块基类
    /// </summary>
    public abstract class BulletCoreModuleBase : IDisposable
    {
        public Bullet BaseBullet { get; private set; }
        protected Transform CtrlObj => BaseBullet.transform;

        public BulletCoreModuleBase(Bullet obj)
        {
            BaseBullet = obj;
        }

        #region Main Methods

        public virtual void InitState()
        {
        }

        public virtual void Update()
        {
        }

        public virtual void FixedUpdate()
        {
            
        }

        public virtual void OnBulletStop()
        {
        }

        public virtual void Destroy()
        {
            Dispose();
        }

        public void Dispose()
        {
            BaseBullet = null;
        }

        #endregion

        /// <summary>
        /// 使用数据管道对子弹的数据进行重写
        /// </summary>
        /// <param name="dataPipeline"></param>
        public virtual void OnBulletDataOverride(Bullet.BulletDataPipeline dataPipeline)
        {
        }

        #region Event Methods

        public virtual void OnBulletHit(Collider2D collider)
        {
        }

        #endregion
        
    }
}